<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@include file="../base.jsp" %> 
<sys:genericTag4o id="roleList" methodName="queryRoleList" className="com.tmpt.controller.taglib.SecurityTag"/>
<sys:genericTag4o id="empList"  methodName="getEmpList"  className="com.tmpt.controller.taglib.SecurityTag"/>
<sys:genericTag4o id="authList" methodName="getAuthList" className="com.tmpt.controller.taglib.SecurityTag"/>
<sys:genericTag4o id="deptList" methodName="getDeptList" className="com.tmpt.controller.taglib.SecurityTag"/>
<sys:genericTag4o id="empList2" methodName="getEmpListWaiting" className="com.tmpt.controller.taglib.SecurityTag"/>
<sys:genericTag4o id="deptList" methodName="getDeptList" className="com.tmpt.controller.taglib.SecurityTag"/>

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title></title>    
<link href="../css/main.css" rel="stylesheet" type="text/css" >
<link rel="stylesheet" type="text/css" href="../../js/jquery/easyui/themes/default/easyui.css">
<link rel="stylesheet" type="text/css" href="../../js/jquery/easyui/themes/icon.css">
<script type="text/javascript" src="../../js/jquery-1.8.0.min.js"></script>
<script src="../../js/jquery/easyui/jquery.easyui.min.js"></script>
<script type="text/javascript">
$(function(){
	$('#tt1').tree();
});

function addRole(){  
    $('#addRoleId').val('处理中..');
    $("#addRoleId").attr({"disabled":"disabled"});
    document.formAddRole.submit();
}

function addAuth(){  
    $('#addAuthId').val('处理中..');
    $("#addAuthId").attr({"disabled":"disabled"});
    document.formAddAuth.submit();
}

function bindingAuthToRole(){  
    $('#bindingAuthToRoleId').val('处理中..');
    $("#bindingAuthToRoleId").attr({"disabled":"disabled"});
    document.formBindingAuthToRole.submit();
}

function unbindingAuthToRole(){  
    $('#unbindingAuthToRoleId').val('处理中..');
    $("#unbindingAuthToRoleId").attr({"disabled":"disabled"});
    document.formUnbindingAuthToRole.submit();
}

function addResource2Auth(){  
    $('#addResource2AuthId').val('处理中..');
    $("#addResource2AuthId").attr({"disabled":"disabled"});
    document.formAddResource2Auth.submit();
}

</script>
</head>
<body class="font14">
<div style="float: left;">
<div style="color: red; text-align: center;">
	<s:property value="#attr.result"/>
</div>
<br/>
<s:form name="formAddRole" id="formAddRole" action="user_addRole.action" namespace="/admin123/user" theme="simple">
<table border="1"  bordercolor="#99BBE8" cellpadding="1" cellspacing="1">
	<caption>增加角色</caption>
	<tr>
		<td>角色名:</td>
		<td>
			<input type="text" name="roleName" maxlength="20">
		</td>
		<td>
			<input type="button" id="addRoleId" value="增加" onclick="addRole()">
		</td>
	</tr>
</table>
</s:form>
<br/>


<s:form  name="formAddAuth" id="formAddAuth" action="user_addAuth.action" namespace="/admin123/user" theme="simple">
<table border="1"  bordercolor="#99BBE8" cellpadding="1" cellspacing="1">
	<caption>添加权限</caption>
	<tr>
		<td>权限名:</td>
		<td>
			<input type="text" name="authName" maxlength="20">
		</td>
		<td>权限描述:</td>
		<td>
			<input type="text" name="authDesc" maxlength="30">
		</td>
		<td>
			<input type="button" id="addAuthId" value="增加" onclick="addAuth()">
		</td>
	</tr>
</table>
</s:form>
<br/>
<form name="formBindingAuthToRole" id="formBindingAuthToRole" action="user_bindingAuthToRole.action" namespace="/admin123/user" theme="simple">
<table border="1"  bordercolor="#99BBE8" cellpadding="1" cellspacing="1">
	<caption>角色和权限绑定</caption>
	<tr>
		<td>角色名:</td>
		<td>
			<s:select 
				list="#attr.roleList"
				listKey="id"
				listValue="roleName"
				headerKey=""
				headerValue="请选择"
				theme="simple"
				name="roleId"
				/>
		</td>
		<td>权限名:</td>
		<td>
			<s:select 
				list="#attr.authList"
				listKey="id"
				listValue="authName"
				headerKey=""
				headerValue="请选择"
				theme="simple"
				name="authId"
				/>
		</td>
		<td>
			<input type="button" id="bindingAuthToRoleId" value="绑定" onclick="bindingAuthToRole()">
		</td>
	</tr>
</table>
</form>
<br/><form name="formUnbindingAuthToRole" id="formUnbindingAuthToRole"  action="user_unbindingAuthToRole.action" namespace="/admin123/user" theme="simple">
<table border="1"  bordercolor="#99BBE8" cellpadding="1" cellspacing="1">
	<caption>角色和权限解绑</caption>
	<tr>
		<td>角色名:</td>
		<td>
			<s:select 
				list="#attr.roleList"
				listKey="id"
				listValue="roleName"
				headerKey=""
				headerValue="请选择"
				theme="simple"
				name="roleId"
				/>
		</td>
		<td>权限名:</td>
		<td>
			<s:select 
				list="#attr.authList"
				listKey="id"
				listValue="authName"
				headerKey=""
				headerValue="请选择"
				theme="simple"
				name="authId"
				/>
		</td>
		<td>
			<input type="button" id="unbindingAuthToRoleId" value="解绑" onclick="unbindingAuthToRole()">
		</td>
	</tr>
</table>
</form>
<br/>
<s:form name="formAddResource2Auth" id="formAddResource2Auth" action="user_addResource2Auth.action" namespace="/admin123/user" theme="simple">
<table border="1"  bordercolor="#99BBE8" cellpadding="1" cellspacing="1">
	<caption>添加资源给权限</caption>
	<tr>
		<td>权限名:</td>
		<td>
			<s:select 
				list="#attr.authList"
				listKey="id"
				listValue="authName"
				headerKey=""
				headerValue="请选择"
				theme="simple"
				name="authId"
				/>
		</td>
	</tr>
	<tr>
		<td>资源URL:</td>
		<td>
			<input type="text" name="resourceName" size="50" maxlength="100">
		</td>
	</tr>
	<tr>
		<td>资源描述:</td>
		<td>
			<input type="text" name="resourceDesc" size="50" maxlength="50">
		</td>
	</tr>
	<tr>
		<td colspan="2">
			<input type="button" id="addResource2AuthId" value="增加" onclick="addResource2Auth()">
		</td>
	</tr>
</table>
</s:form>
</div>

<div style="float: left; margin-left: 20px;">
<table class="table2" cellpadding="0" cellspacing="0">
	<thead>
	<tr>
		<td>角色与权限的树结构关系</td>
	</tr>
	</thead>
	<tr>
		<td>
		<div style="width: 500px; margin: 10px;" >
			<ul id="tt1" url="roleJson.jsp" animate="true"></ul>
		</div>
		</td>
	</tr>
</table>
</div>

</body>
</html>